//
//  LogInView.m
//  KYProject
//
//  Created by Mxxx on 2016/12/21.
//  Copyright © 2016年 Roman. All rights reserved.
//

#import "LogInView.h"
#import "NetWorkManager.h"
@interface LogInView()

@property (nonatomic,strong)Users *us;
@end
@implementation LogInView


//加载Xib类方法
+ (instancetype)logIn
{
    return [[[NSBundle mainBundle]loadNibNamed:@"LogInView" owner:nil options:nil]lastObject];
}

#pragma mark
#pragma mark - 点击登录

- (IBAction)clickButtonLogin:(UIButton *)sender
{
    
    NSString *userName = self.textFileUserName.text;
    NSString *passWord = self.textFilePassWord.text;
    
    [[NetWorkManager sharedManage]loginUserWihtAccount:userName password:passWord successBlock:^(Users *dto)
     {
         self.us = dto;
         if(self.CompleteBlock)
         {
             _CompleteBlock(dto);
         }
         NSLog(@"%@",self.us);
     }
     errorBlock:^(NSString *error) {
         NSLog(@"账号密码错误");
     }];
}

#pragma mark
#pragma mark - 点击短信验证登录
- (IBAction)clickButtonToSendMsgForLogin:(UIButton *)sender
{
    self.tag = sender.tag;
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

#pragma mark
#pragma mark - 点击注册
- (IBAction)buttonRegister:(UIButton *)sender
{
    self.tag = sender.tag;
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

#pragma mark
#pragma mark - 点击忘记密码
- (IBAction)buttonForgetPassWord:(UIButton *)sender
{
    self.tag = sender.tag;
    [self sendActionsForControlEvents:UIControlEventValueChanged];
}

#pragma mark
#pragma mark - 点击屏幕取消编辑模式
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.textFileUserName endEditing:YES];
    [self.textFilePassWord endEditing:YES];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
